<?
	require_once('../inc.php');
	require_once('cURL.php');
	$results = User::GetAll();
	
	$curl = new mycurl('http://www.worldweatheronline.com/feed/weather.ashx?q=new+paltz&format=json&num_of_days=2&key=59ac6b61bc163931101811');	
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>Untitled Document</title>
    </head>
    
    <body>
        <a href="edit.php">Create New</a> <a href="allUsersCSV.php">Download</a>
        <?=$conn->connect_error ?>
            <table>
                <tr>
                    <th></th><th>Actions</th><th>First</th><th>Last</th><th>Password</th><th>Birthday</th><th></th><th>Curent name on facebook</th>
                </tr>
                <? while($rs = $results->fetch_assoc()){ ?>
                <?
                        $curl->createCurl("http://graph.facebook.com/$rs[fbid]");
                        $json = json_decode($curl);
                ?>
                <tr>
                    <td>
                        <img src="http://graph.facebook.com/<?=$rs['fbid']?>/picture" />
                    </td>
                    <td>
                        <a href="details.php?id=<?=$rs['id']?>">View</a>
                        <a href="edit.php?id=<?=$rs['id']?>">Edit</a>
                        <a href="delete.php?id=<?=$rs['id']?>">Delete</a>
                    </td>
                    <td><?=$rs['FirstName']?></td>
                    <td><?=$rs['LastName']?></td>
                    <td><?=$rs['Password']?></td>
                    <td><?=date('M d, Y', strtotime( $rs['Birthday'] )) ?></td>
                    <td><?=$rs['created_at']?></td>
                    <td><?=$json->name?></td>
                </tr>
                <? } ?>
            </table>
    </body>
</html>
<? // $conn->close(); ?>